<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>${siteName!""}|快递管理-${title!""}</title>
    <#include "../common/header.ftl"/>
    <style>
        td {
            vertical-align: middle;
        }
    </style>
</head>

<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside class="lyear-layout-sidebar">

            <!-- logo -->
            <div id="logo" class="sidebar-header">
                <a href="/system/index">${siteName!""}</a>
            </div>
            <div class="lyear-layout-sidebar-scroll">
                <#include "../common/left-menu.ftl"/>
            </div>

        </aside>
        <!--End 左侧导航-->

        <#include "../common/header-menu.ftl"/>

        <!--页面主要内容-->
        <main class="lyear-layout-content">

            <div class="container-fluid">

                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-toolbar clearfix">
                                <form class="pull-right search-bar" method="get" action="list" role="form">
                                    <div class="input-group">
                                        <div class="input-group-btn">
                                            <button class="btn btn-default dropdown-toggle" id="search-btn"
                                                    data-toggle="dropdown" type="button" aria-haspopup="true"
                                                    aria-expanded="false">
                                                订单编号 <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu">
                                                <li><a tabindex="-1" href="javascript:void(0)"
                                                       data-field="title">订单编号</a></li>
                                            </ul>
                                        </div>
                                        <input type="text" class="form-control" value="${waybillNumber!""}"
                                               name="waybillNumber"
                                               placeholder="请输入订单编号">
                                        <span class="input-group-btn">
                                            <button class="btn btn-primary" type="submit">搜索</button>
                                        </span>
                                    </div>
                                </form>
                                <#include "../common/third-menu.ftl"/>
                            </div>
                            <div class="card-body">

                                <div class="table-responsive">
                                    <table class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <th>订单编号</th>
                                            <th>寄件人联系方式</th>
                                            <th>寄件人地址</th>
                                            <th>收件人地址</th>
                                            <th>物品类型</th>
                                            <th>物品重量</th>
                                            <th>付款方式</th>
                                            <th>下单时间</th>
                                            <th>备注</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <#if pageBean.content?size gt 0>
                                            <#list pageBean.content as expressMailOrder>
                                                <tr>
                                                    <td style="vertical-align:middle;">${expressMailOrder.waybillNumber}</td>
                                                    <td style="vertical-align:middle;">
                                                        <#if expressMailOrder.senderMobile??>
                                                            手机:${expressMailOrder.senderMobile}
                                                        </#if>
                                                        <#if expressMailOrder.senderLandlineNumber??>
                                                            <#if expressMailOrder.senderLandlineNumber?length  gt 0>
                                                                座机:${expressMailOrder.senderLandlineNumber}
                                                            </#if>
                                                        </#if>
                                                    </td>
                                                    <td style="vertical-align:middle;">
                                                        ${expressMailOrder.sendFullAddress}
                                                        ${expressMailOrder.sendAddress}
                                                    </td>
                                                    <td style="vertical-align:middle;">
                                                        ${expressMailOrder.recipientsFullAddress}
                                                        ${expressMailOrder.recipientsAddress}
                                                    </td>
                                                    <td style="vertical-align:middle;">
                                                        ${expressMailOrder.itemType}
                                                    </td>
                                                    <td style="vertical-align:middle;">
                                                        ${expressMailOrder.itemWeight}
                                                    </td>

                                                    <td style="vertical-align:middle;">
                                                        ${expressMailOrder.paymentMethod.getName()}
                                                    </td>
                                                    <td style="vertical-align:middle;" style="vertical-align:middle;">
                                                        <font
                                                                class="text-success">${expressMailOrder.createTime}</font>
                                                    </td>
                                                    <td style="vertical-align:middle;">
                                                        ${expressMailOrder.remark!""}
                                                    </td>
                                                    <td style="vertical-align:middle;">
                                                        <#if expressMailOrder.orderStatus == 0>
                                                            <button class="btn btn-w-md btn-round btn-info"
                                                                    onclick="takeDeliveryOfGoods(this)"
                                                                    data-id="${expressMailOrder.id}">揽收
                                                            </button>
                                                        </#if>
                                                    </td>
                                                </tr>
                                            </#list>
                                        <#else>
                                            <tr align="center">
                                                <td colspan="11">这里空空如也！</td>
                                            </tr>
                                        </#if>
                                        </tbody>
                                    </table>
                                </div>
                                <#if pageBean.total gt 0>
                                    <ul class="pagination ">
                                        <#if pageBean.currentPage == 1>
                                            <li class="disabled"><span>«</span></li>
                                        <#else>
                                            <li><a href="list?waybillNumber=${waybillNumber!""}&currentPage=1">«</a>
                                            </li>
                                        </#if>
                                        <#list pageBean.currentShowPage as showPage>
                                            <#if pageBean.currentPage == showPage>
                                                <li class="active"><span>${showPage}</span></li>
                                            <#else>
                                                <li>
                                                    <a href="list?waybillNumber=${waybillNumber!""}&currentPage=${showPage}">${showPage}</a>
                                                </li>
                                            </#if>
                                        </#list>
                                        <#if pageBean.currentPage == pageBean.totalPage>
                                            <li class="disabled"><span>»</span></li>
                                        <#else>
                                            <li>
                                                <a href="list?waybillNumber=${waybillNumber!""}&currentPage=${pageBean.totalPage}">»</a>
                                            </li>
                                        </#if>
                                        <li><span>共${pageBean.totalPage}页,${pageBean.total}条数据</span></li>
                                    </ul>
                                </#if>
                            </div>
                        </div>
                    </div>

                </div>

            </div>

        </main>
        <!--End 页面主要内容-->
    </div>
</div>


<#include "../common/footer.ftl"/>
<script type="text/javascript" src="/admin/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="/admin/js/main.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {

    });

    function takeDeliveryOfGoods(t) {
        $(t).attr("disabled",true)
        let id = $(t).attr("data-id");
        $.ajax({
            url: '/admin/expressMailOrder/takeDeliveryOfGoods',
            type: 'POST',
            data: {id: id},
            dataType: 'json',
            success: function (data) {
                if (data.code == 0) {
                    showSuccessMsg("快递订单揽收完成!请前往网点发货管理发出货物", function () {
                        $(t).parents("tr").remove();
                    })
                } else {
                    showErrorMsg(data.msg);
                }
            },
            error: function (data) {
                alert('网络错误!');
            }
        });
    }



</script>
</body>
</html>